# import pymysql
# import time
# tic1 = time.perf_counter()
# # 获取连接和游标
# conn = pymysql.connect(host="yang-sql.mysql.rds.aliyuncs.com", port=13306, user="yang", passwd="Yy123456", db="secondhand")
# # conn, cur = get_conn_mysql(data['host'], int(data['port']), data['username'], data['password'], data['db'])
#
# # 将连接成功的数据库信息存放到session
# cur = conn.cursor()
# # 查询该数据库的所有表
# cur.execute('select * from flts')
# result = list(cur.fetchall())
# # 关闭连接和游标
# cur.close()
# conn.close()
# toc1 = time.perf_counter()
# shijian1 = toc1-tic1
# print("查询结束,耗时", shijian1)


# import pandas as pd
# data = pd.read_csv('C:/Users/51635/Desktop/sample_1k_flts/sample_1k_flts.csv', nrows=1000000)
# data.to_csv('aviation_info.csv')

import re
f = open('holiday.csv', mode='w+', encoding='utf-8', newline='\n')
import csv
w = csv.writer(f)
w.writerow(['date', 'holiday'])
with open('ttt.txt', mode='r') as file:
    for line in file.readlines():
        result = re.findall(r'#ff0000>(.*?)&nbsp;<WBR>&nbsp;<WBR> (.*?)</FON', line)
        if len(result) > 0 and '*' not in result[0][0]:

            w.writerow(['2012/' + result[0][0].replace('.', '/'), result[0][1]])
